/*
 * @Author: Xiaohan Ma
 * @Date: 2018-08-21 10:15:08
 * @Last Modified by: Xiaohan Ma
 * @Last Modified time: 2018-08-21 10:21:25
 */
const BasicLogic = require('../BasicLogic.js');
module.exports = class extends BasicLogic {
  get scope() {

  }
  addAction() {
    this.allowMethods = 'post';
    this.rules = {
      title: {
        string: true,
        required: true,
        byteLength: {min: 2, max: 50} // 字节长度
      }
    };
  }
  delAction() {
    this.allowMethods = 'delete';
    this.rules = {
      id: {
        string: true,
        required: true
      }
    };
  }
  deleteFileAction() {
    this.allowMethods = 'delete';
    this.rules = {
      id: {
        string: true,
        required: true
      }
    };
  }
  editAction() {
    this.allowMethods = 'post';
    this.rules = {
      id: {
        string: true,
        required: true
      }
    };
  }
  uploadfilesAction() {
    this.allowMethods = 'post';
    this.rules = {
      relation_id: {
        string: true,
        required: true
      }
    };
  }

  downloadAction() {
    this.allowMethods = 'post';
    this.rules = {
      filepath: {
        string: true,
        required: true
      }
    };
  }

  getUploadFileByIdAction() {
    this.allowMethods = 'get';
    this.rules = {
      id: {
        string: true,
        required: true
      }
    };
  }
};
